home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / forth / pfe-0.000 / pfe-0 / pfe-0.9.13 / test / benchm.blk < prev    next >
Encoding:
Text File  |  1995-04-16  |  6.0 KB  |  1 lines

  1. \ BENCHMARK PROGRAM FOR PFE                   duz 17:13 11/09/93                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \ LOAD SCREEN FOR BENCHMARKS                  duz 18:53 09/06/93                                                                2 LOAD      ( good old sieve benchmark )                        3 LOAD      ( several other benchmarks )                        5 LOAD      ( running the benchmarks )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \ Eratosthenes sieve (Byte-benchmark)         duz 11:38 10/07/94                                                                FORTH DEFINITIONS DECIMAL                                       8190 CONSTANT SIZE      CREATE FLAGS    SIZE ALLOT                                                                              : DO-PRIME  FLAGS SIZE 1 FILL                                               0 SIZE 0                                                        DO  FLAGS I + C@                                                    IF  I DUP + 3 + DUP I +                                             BEGIN   DUP SIZE <                                              WHILE   0 OVER FLAGS + C! OVER +                                REPEAT  DROP DROP 1+                                        THEN                                                        LOOP ;                                              : BENCHMARK 0 10 0 DO DROP DO-PRIME LOOP                                    . ." Primes" ;                                      \ Other Benchmarks                            duz 18:52 09/06/93                                                                \ Most popular 1 million loops:                                 : SIMPLE    1000000 0 DO  LOOP ;                                \ This one was discussed in comp.lang.forth:                    : INNER     1000 0 DO 123456789 DROP LOOP ;                     : OUTER     1000 0 DO INNER LOOP ;                                                                                              \ Tests nesting speed. Recursive fibonacci function:            : FIB       DUP 1 >                                                         IF  DUP 1- RECURSE  SWAP 2- RECURSE +  THEN ;                                                                       \ This one tests dictionary search speed:                       : SEARCHSP  100 0 DO  SP@ >R  [ BLK @ 1+ ] LITERAL LOAD  R> SP!             LOOP ;                                                                                                              \ 256 numbers, a hard screen to load!         duz 17:16 11/09/93                                                                \ This screen requires >256 dictionary searches,                \ much more than an average source screen.                      \ Loading it 100 times should take about as long as             \ a moderately large program takes to load.                                                                                     4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5 6 7 8 9 4 5                                                                 \ Running the benchmarks                      duz 12:25 04/16/95                                                                VARIABLE BEGUN                                                  : {{        CLOCK BEGUN ! ;                                     : }}        CLOCK BEGUN @ - 1000 CLK_TCK */                                 35 TAB ." TOOK " 5 .R ."  ms " ;                                                                                    : ALL-BENCHMARKS                                                            CR ." RUNNING `BENCHMARK': " {{ BENCHMARK }}                    CR ." RUNNING `SIMPLE':    " {{ SIMPLE    }}                    CR ." RUNNING `OUTER':     " {{ OUTER     }}                    CR ." RUNNING `25 FIB':    " {{ 25 FIB .  }}                    CR ." RUNNING `SEARCHSP':  " {{ SEARCHSP  }} ;                                                                      ALL-BENCHMARKS